﻿using FluentValidation.Attributes;
using Nop.Admin.Models.Common;
using Nop.Admin.Validators.XJ;
using Nop.Core.Domain.XJ;
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Nop.Admin.Models.XJ
{
	public class InspectionPlanListModel
	{
		public InspectionPlanListModel()
		{
			AvailableTypes = new List<SelectListItem>();
			AvailableAims = new List<SelectListItem>();
			AvailableCategorys = new List<SelectListItem>();
			AvailablePlaces = new List<SelectListItem>();
			AvailableDepartments = new List<SelectMenuModel>();
		}
		/// <summary>
		/// 巡检类型
		/// </summary>
		public int SearchTypeId { get; set; }
		/// <summary>
		/// 巡检目标
		/// </summary>
		public int SearchAimId { get; set; }
		/// <summary>
		/// 设施设备类别
		/// </summary>
		[UIHint("SelectMenu")]
		public int SearchCategoryId { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		[UIHint("SelectMenu")]
		public int SearchPlaceId { get; set; }
		/// <summary>
		/// 部门
		/// </summary>
		[UIHint("SelectMenu")]
		public int SearchDepartId { get; set; }
		public string SearchPNo { get; set; }
		public string SearchName { get; set; }
		/// <summary>
		/// 巡检类型
		/// </summary>
		public IList<SelectListItem> AvailableTypes { get; set; }
		/// <summary>
		/// 巡检目标
		/// </summary>
		public IList<SelectListItem> AvailableAims { get; set; }
		/// <summary>
		/// 设施设备类别
		/// </summary>
		public IList<SelectListItem> AvailableCategorys { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public IList<SelectListItem> AvailablePlaces { get; set; }
		/// <summary>
		/// 部门
		/// </summary>
		public IList<SelectMenuModel> AvailableDepartments { get; set; }
	}

	[Validator(typeof(InspectionPlanValidator))]
	public class InspectionPlanModel : BaseNopEntityModel
	{
		public InspectionPlanModel()
		{
			CategoryIds = new List<int>();
			AvailableTypes = new List<SelectListItem>();
			AvailableAims = new List<SelectListItem>();
			AvailableCategorys = new List<SelectListItem>();
			AvailablePlaces = new List<SelectListItem>();
			AvailableDepartments = new List<SelectMenuModel>();
			AvailableMaintenanceDepartments = new List<SelectMenuModel>();
			AvailableUsers = new List<SelectListItem>();
			AvailableMaintenanceUsers = new List<SelectListItem>();
		}
		/// <summary>
		/// 计划编号
		/// </summary>
		[NopResourceDisplayName("计划编号", true)]
		public string PNo { get; set; }
		/// <summary>
		/// 计划名称
		/// 有名称，巡检内容里显示名称；没有名称，巡检内容显示具体的巡检点、设备分类
		/// </summary>
		[NopResourceDisplayName("计划名称", true, "列表中默认显示计划名称，没有计划名称时显示巡检内容")]
		public string Name { get; set; }
		[NopResourceDisplayName("巡检内容", true)]
		public string Content { get; set; }
		/// <summary>
		/// 类型：日巡检、周巡检、月巡检
		/// <see cref="InspectionTypeEnum"/>
		/// </summary>
		[NopResourceDisplayName("巡检类型", true)]
		public int TypeId { get; set; }
		/// </summary>
		[NopResourceDisplayName("巡检类型", true)]
		public string TypeName { get; set; }
		/// <summary>
		/// 巡检目标
		/// <see cref="AimTypeEnum"/>
		/// </summary>
		[NopResourceDisplayName("巡检目标", true)]
		public int AimId { get; set; }
		[NopResourceDisplayName("巡检目标", true)]
		public string AimName { get; set; }
		/// <summary>
		/// 设施设备类别
		/// </summary>
		[NopResourceDisplayName("设备分类", true)]
		[UIHint("MultiSelect")]
		public IList<int> CategoryIds { get; set; }
		[NopResourceDisplayName("设备分类", true)]
		public string CategoryNames { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		[NopResourceDisplayName("巡检点", true)]
		[UIHint("MultiSelect")]
		public IList<int> PlaceIds { get; set; }
		[NopResourceDisplayName("巡检点", true)]
		public string PlaceNames { get; set; }
		/// <summary>
		/// 巡检班组Id
		/// </summary>
		[NopResourceDisplayName("巡检班组", true)]
		[UIHint("SelectMenu")]
		public int TeamId { get; set; }
		[NopResourceDisplayName("巡检班组", true)]
		public string TeamName { get; set; }
		/// <summary>
		/// 巡检人员Id
		/// </summary>
		[NopResourceDisplayName("巡检人员", true)]
		public int PersonId { get; set; }
		[NopResourceDisplayName("巡检人员", true)]
		public string PersonName { get; set; }
		/// <summary>
		/// 维修班组Id
		/// </summary>
		[NopResourceDisplayName("维修班组", true)]
		[UIHint("SelectMenu")]
		public int MaintenanceTeamId { get; set; }
		[NopResourceDisplayName("维修班组", true)]
		public string MaintenanceTeamName { get; set; }
		/// <summary>
		/// 维修人员Id
		/// </summary>
		[NopResourceDisplayName("维修人员", true)]
		public int MaintenancePersonId { get; set; }
		[NopResourceDisplayName("维修人员", true)]
		public string MaintenancePersonName { get; set; }
		/// <summary>
		/// 计划开始日期
		/// </summary>
		[NopResourceDisplayName("开始时间", true)]
		[UIHint("Date")]
		public DateTime StartOn { get; set; }
		/// <summary>
		/// 计划结束日期
		/// </summary>
		[NopResourceDisplayName("结束时间", true)]
		[UIHint("Date")]
		public DateTime EndOn { get; set; }
		/// <summary>
		/// 最后巡检日期
		/// </summary>
		[NopResourceDisplayName("最后巡检日期", true)]
		public DateTime? LastUpdateOn { get; set; }
		/// <summary>
		/// 漏检天数
		/// </summary>
		[NopResourceDisplayName("漏检天数", true)]
		public int LossTime { get; set; }
		/// <summary>
		/// 发布
		/// </summary>
		[NopResourceDisplayName("发布", true)]
		public bool Published { get; set; }
		/// <summary>
		/// 创建人
		/// </summary>
		public int CustomerId { get; set; }
		/// <summary>
		/// 创建时间
		/// </summary>
		public DateTime CreatedOn { get; set; }
		/// <summary>
		/// 巡检分类
		/// </summary>
		public IList<SelectListItem> AvailableTypes { get; set; }
		/// <summary>
		/// 巡检目标
		/// </summary>
		public IList<SelectListItem> AvailableAims { get; set; }
		/// <summary>
		/// 设施设备类别
		/// </summary>
		public IList<SelectListItem> AvailableCategorys { get; set; }
		/// <summary>
		/// 巡检点
		/// </summary>
		public IList<SelectListItem> AvailablePlaces { get; set; }
		/// <summary>
		/// 部门班组
		/// </summary>
		public IList<SelectMenuModel> AvailableDepartments { get; set; }
		/// <summary>
		/// 维修部门
		/// </summary>
		public IList<SelectMenuModel> AvailableMaintenanceDepartments { get; set; }
		/// <summary>
		/// 巡检人员
		/// </summary>
		public IList<SelectListItem> AvailableUsers { get; set; }
		/// <summary>
		/// 维修人员
		/// </summary>
		public IList<SelectListItem> AvailableMaintenanceUsers { get; set; }
	}
}